import React, { Component } from 'react'
import Style from "../style/getdom.module.css"
import Mask from './mask'
 class Father extends Component {
  state = {
      flag:false,
      title:"我是父组件传过来的数据"
  }
  showMask(){
      this.setState({
        flag:!this.state.flag
      })
  }
  fasendson = (data)=>{
        this.setState({
            flag:data
        })
  }
  render() {
    return (
      <div className={Style.father}>
          <button onClick={this.showMask.bind(this)} className="btn">点击</button>
          {
              this.state.flag? <Mask sendfn = {this.fasendson} title={this.state.title}></Mask>:""
          }
       
      </div>
    )
  }
}

export default Father